// detail.js
document.addEventListener('DOMContentLoaded', () => {
    const addCommentForm = document.getElementById('addCommentForm');
    const commentList = document.getElementById('commentList');

    addCommentForm.addEventListener('submit', (e) => {
        e.preventDefault();
        const name = document.getElementById('name').value;
        const comment = document.getElementById('comment').value;

        if (name && comment) {
            const commentItem = document.createElement('li');
            commentItem.className = 'comment-item';

            commentItem.innerHTML = `
                <p class="comment-author">${name}</p>
                <p class="comment-text">${comment}</p>
                <p class="comment-date">${new Date().toISOString().slice(0, 10)}</p>
            `;

            commentList.appendChild(commentItem);
            addCommentForm.reset();
        }
    });
});
